<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'user_add.jsp' starting page</title>
    
    <link rel="stylesheet" type="text/css" href="js/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="js/themes/icon.css">
    <script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="js/locale/easyui-lang-zh_CN.js"></script>
    
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript">
		$(function(){			 
			  $('#grid').datagrid({   
				  	  idField:'id',
				      url:'json/flowCardDetail_search.action',
				      title:'查询结果',
				      striped:true,
				      loadMsg:'正在加载中，请等待....',
				      pagination:true,
				      fitColumns:true,
				      rownumbers:true,
				      pageSize:7,
				      pageList:[7,14,21,28,35],
				      
				      frozenColumns:[
										[{
											field:'cb',
											checkbox:true									
										 }]				               
						               ],
				      columns:[[   
						  {field:'flowCardId',title:'流向单号',width:70},
						  {field:'clientId',title:'供方分销商号',width:100},
						  {field:'clientName',title:'供方分销商名',width:200},
						  {field:'aimClientId',title:'需求客户号',width:70},
						  {field:'aimClientName',title:'需求客户名',width:200},
						  {field:'itemId',title:'物料号',width:50},
						  {field:'itemName',title:'物料名',width:150},
				          {field:'spec',title:'规格',width:50},   
				          {field:'pattern',title:'型号',width:50},   
				          {field:'unit',title:'单位',width:50},   
				          {field:'count',title:'数量',width:50},
				          {field:'price',title:'单价',width:50}
				      ]] 
				  });
			  
			  	$('#search').click(function(){
					$('#grid').datagrid('load' ,serializeForm($('#myform')));
				});
				
				
				$('#clear').click(function(){
					$('#myform').form('clear');
					$('#grid').datagrid('load' ,{});
				});
		});		

		//js方法：序列化表单 			
		function serializeForm(form){
			var obj = {};
			$.each(form.serializeArray(),function(index){
				if(obj[this['name']]){
					obj[this['name']] = obj[this['name']] + ','+this['value'];
				} else {
					obj[this['name']] =this['value'];
				}
			});
			return obj;
		}
		
	</script>

  </head>
  
  <body>
  	  <form id="myform" action="" method="post">
  	  	流向单号：<input type="text" name="flowCardId"> <br>
	  	供方分销商号：<input type="text" name="clientId"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;需方客户号：<input type="text" name="aimClientId"><br>
	  	供方分销商名：<input type="text" name="clientName">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;需方客户名：<input type="text" name="aimClientName"><br>
	  	物料号：<input type="text" name="itemId">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;物料名：<input type="text" name="itemNmae"><br>
	  	<a id="search" class="easyui-linkbutton">查询</a> <a id="clear" class="easyui-linkbutton">清空</a>
	  </form> 
	  <br><br>
	  <table id="grid"></table>  	 		 	 	 		
  </body>
</html>
